<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
 Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="Port.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>Port.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		No overview generated for 'Port.js'<BR/><BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="draw2d/Port.html">draw2d.Port</a></b></td>
    <td>A Port is the anchor for a <a href="../draw2d/Connection.html#">draw2d.Connection</a>.</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/* This notice must be untouched at all times.

FreeGroup Draw2D 0.9.26
The latest version is available at
http://www.freegroup.de

Copyright (c) 2006 Andreas Herz. All rights reserved.
Created 5. 11. 2006 by Andreas Herz (Web: http://www.freegroup.de )

LICENSE: LGPL

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
or see http://www.gnu.org/copyleft/lesser.html
*/</span>

<span class="comment">/**
 * <span class="attrib">@class</span> A Port is the anchor for a {<span class="attrib">@link</span> draw2d.Connection}. A {<span class="attrib">@link</span> draw2d.Connection} must have a start and a end Port.
 * &lt;br&gt;
 * <span class="attrib">@version</span> 0.9.26
 * <span class="attrib">@author</span> Andreas Herz
 * <span class="attrib">@param</span> {draw2d.Figure} uiRepresentation The figure to paint this Port. This parameter is optional.
 * <span class="attrib">@constructor</span>
 */</span>
draw2d.Port=<span class="reserved">function</span>(<span class="comment">/*:draw2d.Figure*/</span> disconnectedUIRepresentation,<span class="comment">/*:draw2d.Figure*/</span> connectedUIRepresentation)
{
  <span class="comment">// Inner Class for the port corona. Why?! The runtime increment the alpha value from 0-1 if you add </span>
  <span class="comment">// an element to the canvas if you have set workflow.setSmoothFigureHandling(true). But the corona should have max. alpha=0.3.</span>
  <span class="comment">//</span>
  Corona = <span class="reserved">function</span>(){}
  Corona.<span class="reserved">prototype</span> = new draw2d.Circle();
  Corona.<span class="reserved">prototype</span>.setAlpha=<span class="reserved">function</span>(<span class="comment">/*:float 0-1*/</span> percent)
  {
     draw2d.Circle.<span class="reserved">prototype</span>.setAlpha.call(<span class="reserved">this</span>, Math.min(0.3,percent));
    <span class="reserved">this</span>.setDeleteable(false);
    <span class="reserved">this</span>.setCanDrag(false);
    <span class="reserved">this</span>.setResizeable(false);
    <span class="reserved">this</span>.setSelectable(false);
  }

  <span class="comment">// Die graphische Representation des Elementes</span>
  <span class="comment">//</span>
  <span class="reserved">if</span>(disconnectedUIRepresentation===null || disconnectedUIRepresentation===undefined)
    <span class="reserved">this</span>.currentUIRepresentation = new draw2d.Circle();
  <span class="reserved">else</span>
    <span class="reserved">this</span>.currentUIRepresentation = disconnectedUIRepresentation;


  <span class="reserved">if</span>(connectedUIRepresentation===null  || connectedUIRepresentation===undefined)
  {
   <span class="reserved">this</span>.connectedUIRepresentation = new draw2d.Circle();
   <span class="reserved">this</span>.connectedUIRepresentation.setColor(null);
  }
  <span class="reserved">else</span>
  {
   <span class="reserved">this</span>.connectedUIRepresentation = connectedUIRepresentation;
  }

  <span class="reserved">this</span>.disconnectedUIRepresentation = <span class="reserved">this</span>.currentUIRepresentation;
  <span class="reserved">this</span>.hideIfConnected = false;

  <span class="comment">// a flag which indicates that the HTML of the port ui representation has </span>
  <span class="comment">// been added to the DOM tree.</span>
  <span class="comment">//</span>
  <span class="reserved">this</span>.uiRepresentationAdded=true;

  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.parentNode = null;
  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.originX=0; <span class="comment">// the fix point of the port.</span>
  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.originY=0;

  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.coronaWidth=10; <span class="comment">// the corona width for the isOver method. Usefull during drag&amp;drop of ports. Better SnapTo behaviour.</span>

  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.corona=null; <span class="comment">// Circle</span>

  draw2d.Rectangle.call(<span class="reserved">this</span>);
  <span class="reserved">this</span>.setDimension(8,8);
  <span class="reserved">this</span>.setBackgroundColor(new  draw2d.Color(100,180,100));
  <span class="reserved">this</span>.setColor(new  draw2d.Color(90,150,90));
  draw2d.Rectangle.<span class="reserved">prototype</span>.setColor.call(<span class="reserved">this</span>,null);
  <span class="comment">/** <span class="attrib">@private</span> **/</span>
  <span class="reserved">this</span>.dropable = new draw2d.DropTarget(<span class="reserved">this</span>.html);
  <span class="reserved">this</span>.dropable.node = <span class="reserved">this</span>;
  <span class="reserved">this</span>.dropable.addEventListener(<span class="literal">"dragenter"</span>, <span class="reserved">function</span> (oEvent)
  {
    oEvent.target.node.onDragEnter(oEvent.relatedTarget.node);
  });
  <span class="reserved">this</span>.dropable.addEventListener(<span class="literal">"dragleave"</span>, <span class="reserved">function</span> (oEvent)
  {
    oEvent.target.node.onDragLeave(oEvent.relatedTarget.node);
  });
  <span class="reserved">this</span>.dropable.addEventListener(<span class="literal">"drop"</span>, <span class="reserved">function</span> (oEvent)
  {
    oEvent.relatedTarget.node.onDrop(oEvent.target.node);
  });
};

draw2d.Port.<span class="reserved">prototype</span> = new draw2d.Rectangle();
<span class="comment">/** <span class="attrib">@private</span> **/</span>
draw2d.Port.<span class="reserved">prototype</span>.type=<span class="literal">"draw2d.Port"</span>;

<span class="comment">/** <span class="attrib">@private</span> **/</span>
draw2d.Port.ZOrderBaseIndex=5000;

<span class="comment">/**
 * Set the common z-index of the window element. This method exists for
 * compatibility reason to dojo or another UI javascript library. 
 * It is now possible to arange the draw2d elements behind/before other UI elements.
 *
 * <span class="attrib">@see</span> #setZOrder
 * <span class="attrib">@static</span>
 * <span class="attrib">@param</span> {int} index The z-order for all new port objects.
 **/</span>
draw2d.Port.setZOrderBaseIndex=<span class="reserved">function</span>(<span class="comment">/*:int*/</span> index)
{
  draw2d.Port.ZOrderBaseIndex = index;
};

<span class="comment">/**
 * Hide the port if a connector has been attach to this.
 * The port doesn't change the functonality. You can drag&amp;drop the port. 
 * It hide's only the UI Representation!
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.setHideIfConnected=<span class="reserved">function</span>(<span class="comment">/*:boolean*/</span> flag)
{
  <span class="reserved">this</span>.hideIfConnected = flag;
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.dispose=<span class="reserved">function</span>()
{
  <span class="comment">// Remove all Connections which are bounded to this port</span>
  <span class="comment">// In this case this are all movement listener</span>
  var size= <span class="reserved">this</span>.moveListener.getSize();
  <span class="reserved">for</span>(var i=0;i&lt;size;i++)
  {
    var target = <span class="reserved">this</span>.moveListener.get(i);
    <span class="reserved">this</span>.parentNode.workflow.removeFigure(target);
    target.dispose();
  }

  draw2d.Rectangle.<span class="reserved">prototype</span>.dispose.call(<span class="reserved">this</span>);
  <span class="reserved">this</span>.parentNode = null;
  <span class="reserved">this</span>.dropable.node=null;
  <span class="reserved">this</span>.dropable = null;
  <span class="reserved">this</span>.disconnectedUIRepresentation.dispose();
  <span class="reserved">this</span>.connectedUIRepresentation.dispose();
};


<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.createHTMLElement=<span class="reserved">function</span>()
{
    var item = draw2d.Rectangle.<span class="reserved">prototype</span>.createHTMLElement.call(<span class="reserved">this</span>);
    item.style.zIndex=draw2d.Port.ZOrderBaseIndex;
    <span class="reserved">this</span>.currentUIRepresentation.html.zIndex=draw2d.Port.ZOrderBaseIndex;
    item.appendChild(<span class="reserved">this</span>.currentUIRepresentation.html);
    <span class="reserved">this</span>.uiRepresentationAdded=true;

    <span class="reserved">return</span> item;
};

<span class="comment">/**
 * Set the representation of this port. The default representation of a port is a green circle.
 *
 * <span class="attrib">@param</span> {draw2d.Figure} figure The new UI representation of this port.
 *
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.setUiRepresentation=<span class="reserved">function</span>(<span class="comment">/*:draw2d.Figure*/</span> figure)
{
  <span class="comment">// a port need a UI representation</span>
  <span class="comment">//</span>
  <span class="reserved">if</span>(figure===null)
     figure = new draw2d.Figure();

  <span class="reserved">if</span>(<span class="reserved">this</span>.uiRepresentationAdded)
    <span class="reserved">this</span>.html.removeChild(<span class="reserved">this</span>.currentUIRepresentation.getHTMLElement());

  <span class="reserved">this</span>.html.appendChild(figure.getHTMLElement());
  figure.paint();

  <span class="reserved">this</span>.currentUIRepresentation = figure;
};

<span class="comment">/**
 * Callback method for the mouse enter event. Usefull for mouse hover-effects.
 * Override this method for yourown effects. Don't call them manually.
 *
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.onMouseEnter=<span class="reserved">function</span>()
{
    <span class="reserved">this</span>.setLineWidth(2);
};


<span class="comment">/**
 * Callback method for the mouse leave event. Usefull for mouse hover-effects.
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.onMouseLeave=<span class="reserved">function</span>()
{
    <span class="reserved">this</span>.setLineWidth(0);
};


<span class="comment">/**
 * Set the dimension of this port.
 *
 * <span class="attrib">@param</span> {int} width The new width of the object
 * <span class="attrib">@param</span> {int} heightThe new height of the object
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.setDimension=<span class="reserved">function</span>(<span class="comment">/*:int*/</span> width, <span class="comment">/*:int*/</span> height)
{
  draw2d.Rectangle.<span class="reserved">prototype</span>.setDimension.call(<span class="reserved">this</span>, width, height);
  <span class="reserved">this</span>.connectedUIRepresentation.setDimension(width, height);
  <span class="reserved">this</span>.disconnectedUIRepresentation.setDimension(width, height);

  <span class="comment">// adjust the position</span>
  <span class="reserved">this</span>.setPosition(<span class="reserved">this</span>.x, <span class="reserved">this</span>.y);
};

<span class="comment">/**
 * Set the background color of the port
 * <span class="attrib">@param</span> {draw2d.Color} color The new background color of the port. 
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.setBackgroundColor=<span class="reserved">function</span>(<span class="comment">/*:draw2d.Color*/</span> color)
{
  <span class="comment">// delegate to the UI representation</span>
  <span class="reserved">this</span>.currentUIRepresentation.setBackgroundColor(color);
};

<span class="comment">/**
 * Returns the background color of this port.
 *
 * <span class="attrib">@type</span> draw2d.Color
 */</span>
draw2d.Port.<span class="reserved">prototype</span>.getBackgroundColor=<span class="reserved">function</span>()
{
  <span class="comment">// delegate to the UI representation</span>
  <span class="reserved">return</span> <span class="reserved">this</span>.currentUIRepresentation.getBackgroundColor();
};


<span class="comment">/**
 * Returns a array of &lt;code&gt;draw2d.Connection&lt;/code&gt; of all related connections to this port.
 *
 * <span class="attrib">@type</span> draw2d.ArrayList
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.getConnections=<span class="reserved">function</span>()
{
  var result = new draw2d.ArrayList();

  <span class="comment">// Return all Connections which are bounded to this port</span>
  <span class="comment">// In this case this are all movement listener</span>

  var size= <span class="reserved">this</span>.moveListener.getSize();
  <span class="reserved">for</span>(var i=0;i&lt;size;i++)
  {
    var target = <span class="reserved">this</span>.moveListener.get(i);
    <span class="reserved">if</span>(target instanceof draw2d.Connection)
       result.add(target);
  }
  <span class="reserved">return</span> result;
};


<span class="comment">/**
 * Set the foreground color of the port
 * <span class="attrib">@param</span> {draw2d.Color} color The new foreground color of the port. 
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.setColor=<span class="reserved">function</span>(<span class="comment">/*:draw2d.Color*/</span> color)
{
  <span class="comment">// delegate to the UI representation</span>
  <span class="reserved">this</span>.currentUIRepresentation.setColor(color);
};

<span class="comment">/**
 * Returns the foreground color of the port.
 *
 * <span class="attrib">@type</span> draw2d.Color
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.getColor=<span class="reserved">function</span>()
{
  <span class="comment">// delegate to the UI representation</span>
  <span class="reserved">return</span> <span class="reserved">this</span>.currentUIRepresentation.getColor();
};

<span class="comment">/**
 * Set the foreground color of the port
 * <span class="attrib">@param</span> {draw2d.Color} color The new foreground color of the port. 
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.setLineWidth=<span class="reserved">function</span>(<span class="comment">/*:int*/</span> width)
{
  <span class="comment">// delegate to the UI representation</span>
  <span class="reserved">this</span>.currentUIRepresentation.setLineWidth(width);
};

<span class="comment">/**
 * Returns the line with of the port border.
 *
 * <span class="attrib">@type</span> int
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.getLineWidth=<span class="reserved">function</span>()
{
  <span class="comment">// delegate to the UI representation</span>
  <span class="reserved">return</span> <span class="reserved">this</span>.currentUIRepresentation.getLineWidth();
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.paint=<span class="reserved">function</span>()
{
  try
  {
    <span class="comment">// delegate to the UI representation</span>
    <span class="reserved">this</span>.currentUIRepresentation.paint();
  }
  catch(e)
  {
      pushErrorStack(e,<span class="literal">"draw2d.Port.prototype.paint=function()"</span>);
  }
};


<span class="comment">/**
 * Set the position of this port 
 *
 * <span class="attrib">@param</span> {int} xPos The new x position of the port.
 * <span class="attrib">@param</span> {int} yPos The new y position of the port.
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.setPosition=<span class="reserved">function</span>(<span class="comment">/*:int*/</span> xPos, <span class="comment">/*:int*/</span> yPos)
{
  <span class="comment">// The origin must be set before the base class will be called.</span>
  <span class="comment">// Reason: The base class fires a onFigureMoved event. And the listener needs sometimes</span>
  <span class="comment">//         the originX/originY coordinates. (e.g. Port and Connection).</span>
  <span class="reserved">this</span>.originX=xPos; <span class="comment">// the fix point of the point.</span>
  <span class="reserved">this</span>.originY=yPos;

  draw2d.Rectangle.<span class="reserved">prototype</span>.setPosition.call(<span class="reserved">this</span>,xPos,yPos);

  <span class="comment">// Falls das Element noch nie gezeichnet wurde, dann braucht aus das HTML nicht </span>
  <span class="comment">// aktualisiert werden</span>
  <span class="comment">//</span>
  <span class="reserved">if</span>(<span class="reserved">this</span>.html===null)
    <span class="reserved">return</span>;

  <span class="reserved">this</span>.html.style.left = (<span class="reserved">this</span>.x-<span class="reserved">this</span>.getWidth()/2)+<span class="literal">"px"</span>;
  <span class="reserved">this</span>.html.style.top  = (<span class="reserved">this</span>.y-<span class="reserved">this</span>.getHeight()/2)+<span class="literal">"px"</span>;
};

<span class="comment">/**
 * Set the parentNode of this port.
 * Call {<span class="attrib">@link</span> draw2d.Node.addPort} if you want to a port to node. Don't call this method directly.
 *
 * <span class="attrib">@private</span>
 */</span>
draw2d.Port.<span class="reserved">prototype</span>.setParent=<span class="reserved">function</span>(<span class="comment">/*:draw2d.Node*/</span> parentNode)
{
  <span class="reserved">if</span>(<span class="reserved">this</span>.parentNode!==null)
    <span class="reserved">this</span>.parentNode.detachMoveListener(<span class="reserved">this</span>);

  <span class="reserved">this</span>.parentNode = parentNode;
  <span class="reserved">if</span>(<span class="reserved">this</span>.parentNode!==null)
    <span class="reserved">this</span>.parentNode.attachMoveListener(<span class="reserved">this</span>);
};

draw2d.Port.<span class="reserved">prototype</span>.attachMoveListener = <span class="reserved">function</span>(<span class="comment">/*:draw2d.Figure*/</span> figure)
{
  draw2d.Rectangle.<span class="reserved">prototype</span>.attachMoveListener.call(<span class="reserved">this</span>,figure);
  <span class="reserved">if</span>(<span class="reserved">this</span>.hideIfConnected==true)
   <span class="reserved">this</span>.setUiRepresentation(<span class="reserved">this</span>.connectedUIRepresentation);
};


draw2d.Port.<span class="reserved">prototype</span>.detachMoveListener = <span class="reserved">function</span>(<span class="comment">/*:draw2d.Figure*/</span> figure)
{
  draw2d.Rectangle.<span class="reserved">prototype</span>.detachMoveListener.call(<span class="reserved">this</span>,figure);
  <span class="reserved">if</span>(<span class="reserved">this</span>.getConnections().getSize()==0)
    <span class="reserved">this</span>.setUiRepresentation(<span class="reserved">this</span>.disconnectedUIRepresentation);
};

<span class="comment">/**
 * Return the parentNode {<span class="attrib">@link</span> draw2d.Node} of this port.
 * <span class="attrib">@type</span> draw2d.Node
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.getParent=<span class="reserved">function</span>()
{
  <span class="reserved">return</span> <span class="reserved">this</span>.parentNode;
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.onDrag = <span class="reserved">function</span>()
{
  draw2d.Rectangle.<span class="reserved">prototype</span>.onDrag.call(<span class="reserved">this</span>);

  <span class="reserved">this</span>.parentNode.workflow.showConnectionLine(<span class="reserved">this</span>.parentNode.x+<span class="reserved">this</span>.x, <span class="reserved">this</span>.parentNode.y+<span class="reserved">this</span>.y, <span class="reserved">this</span>.parentNode.x+<span class="reserved">this</span>.originX, <span class="reserved">this</span>.parentNode.y+<span class="reserved">this</span>.originY);
};

<span class="comment">/**
 * Returns the corona width of the Port. The corona width will be used during the
 * drag&amp;drop of a port.
 *
 * <span class="attrib">@type</span> int
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.getCoronaWidth = <span class="reserved">function</span>()
{
   <span class="reserved">return</span> <span class="reserved">this</span>.coronaWidth;
};


<span class="comment">/**
 * Set the corona width of the Port. The corona width will be used during the
 * drag&amp;drop of a port. You can drop a port in the corona of this port to create
 * a connection. It is not neccessary to drop exactly on the port.
 *
 * <span class="attrib">@param</span> {int} width The new corona width of the port
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.setCoronaWidth = <span class="reserved">function</span>(<span class="comment">/*:int*/</span> width)
{
   <span class="reserved">this</span>.coronaWidth = width;
};

<span class="comment">/**
 * <span class="attrib">@param</span> {int} x The new x-origin of the port
 * <span class="attrib">@param</span> {int} y The new yoriging of the port
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.setOrigin=<span class="reserved">function</span>(<span class="comment">/*:int*/</span> x, <span class="comment">/*:int*/</span> y)
{
  <span class="reserved">this</span>.originX = x;
  <span class="reserved">this</span>.originY = y;
};

<span class="comment">/**
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.onDragend = <span class="reserved">function</span>()
{
  <span class="comment">// Don't call the parent implementation. This will create an CommandMove object</span>
  <span class="comment">// and store them o the CommandStack for the undo operation. This makes no sense for a</span>
  <span class="comment">// port.</span>
  <span class="comment">// draw2d.Rectangle.prototype.onDragend.call(this); DON'T call the super implementation!!!</span>

  <span class="reserved">this</span>.setAlpha(1.0);

  <span class="comment">// 1.) Restore the old Position of the node</span>
  <span class="comment">//</span>
  <span class="reserved">this</span>.setPosition(<span class="reserved">this</span>.originX, <span class="reserved">this</span>.originY);

  <span class="comment">// 2.) Remove the bounding line from the canvas</span>
  <span class="comment">//</span>
  <span class="reserved">this</span>.parentNode.workflow.hideConnectionLine();

  <span class="comment">// Note: very important line of code!!</span>
  <span class="comment">// You can't drag&amp;drop an workflow object if you connect two ports via drag&amp;drop</span>
  <span class="comment">// if you remove these line of code. You must click first into the document an </span>
  <span class="comment">// then you can drag&amp;drop the element on the canvas.</span>
  document.body.focus();
};

<span class="comment">/**
 * <span class="attrib">@param</span> {draw2d.Port} port The port under the current drag object
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.onDragEnter = <span class="reserved">function</span>(<span class="comment">/*:draw2d.Port*/</span> port)
{
  <span class="comment">// Create a CONNECT Command to determine if we can show a Corona. Only valid</span>
  <span class="comment">// dropTarget did have a corona</span>
  var request = new draw2d.EditPolicy(draw2d.EditPolicy.CONNECT);
  request.canvas = <span class="reserved">this</span>.parentNode.workflow;
  request.source = port;
  request.target = <span class="reserved">this</span>;
  var command = <span class="reserved">this</span>.createCommand(request);
  <span class="reserved">if</span>(command===null)
    <span class="reserved">return</span>;

  <span class="reserved">this</span>.parentNode.workflow.connectionLine.setColor(new  draw2d.Color(0,150,0));
  <span class="reserved">this</span>.parentNode.workflow.connectionLine.setLineWidth(3);
  <span class="reserved">this</span>.showCorona(true);
};

<span class="comment">/**
 * <span class="attrib">@param</span> {draw2d.Port} port The port which we leave with the drag object.
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.onDragLeave = <span class="reserved">function</span>(<span class="comment">/*:draw2d.Port*/</span> port)
{
  <span class="reserved">this</span>.parentNode.workflow.connectionLine.setColor(new  draw2d.Color(0,0,0));
  <span class="reserved">this</span>.parentNode.workflow.connectionLine.setLineWidth(1);
  <span class="reserved">this</span>.showCorona(false);
};

<span class="comment">/**
 * <span class="attrib">@param</span> {draw2d.Port} port The drop target.
 * <span class="attrib">@private</span>
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.onDrop = <span class="reserved">function</span>(<span class="comment">/*:draw2d.Port*/</span> port)
{
    var request = new draw2d.EditPolicy(draw2d.EditPolicy.CONNECT);
    request.canvas = <span class="reserved">this</span>.parentNode.workflow;
    request.source = port;
    request.target = <span class="reserved">this</span>;
    var command = <span class="reserved">this</span>.createCommand(request);
    <span class="reserved">if</span>(command !==null)
       <span class="reserved">this</span>.parentNode.workflow.getCommandStack().execute(command);
};


<span class="comment">/**
 * Returns the absolute y-position of the port.
 *
 * <span class="attrib">@type</span> draw2d.Point
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.getAbsolutePosition=<span class="reserved">function</span>()
{
  <span class="reserved">return</span> new draw2d.Point(<span class="reserved">this</span>.getAbsoluteX(), <span class="reserved">this</span>.getAbsoluteY());
};

<span class="comment">/**
 * Returns the absolute y-position of the port.
 *
 * <span class="attrib">@type</span> draw2d.Dimension
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.getAbsoluteBounds=<span class="reserved">function</span>()
{
  <span class="reserved">return</span> new draw2d.Dimension(<span class="reserved">this</span>.getAbsoluteX(), <span class="reserved">this</span>.getAbsoluteY(),<span class="reserved">this</span>.getWidth(),<span class="reserved">this</span>.getHeight());
};

<span class="comment">/**
 * Returns the absolute y-position of the port.
 *
 * <span class="attrib">@type</span> int
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.getAbsoluteY=<span class="reserved">function</span>()
{
  <span class="reserved">return</span> <span class="reserved">this</span>.originY+ <span class="reserved">this</span>.parentNode.getY();
};

<span class="comment">/**
 * Returns the absolute x-position of the port.
 *
 * <span class="attrib">@type</span> int 
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.getAbsoluteX=<span class="reserved">function</span>()
{
  <span class="reserved">return</span> <span class="reserved">this</span>.originX+<span class="reserved">this</span>.parentNode.getX();
};

<span class="comment">/**
 * Callback method of the movemoent of a figure
 * <span class="attrib">@see</span> draw2d.Figure#attachMoveListener
 * <span class="attrib">@param</span> {draw2d.Figure} figure The figure which has been moved
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.onOtherFigureMoved=<span class="reserved">function</span>(<span class="comment">/*:draw2d.Figure*/</span> figure)
{
  <span class="comment">// Falls sich der parentNode bewegt hat, dann muss der Port dies seinen</span>
  <span class="comment">// Connections mitteilen</span>
  <span class="reserved">this</span>.fireMoveEvent();
};

<span class="comment">/**
 * Return the name of this port.
 *
 * <span class="attrib">@see</span> draw2d.Node#getPort
 * <span class="attrib">@type</span> String
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.getName=<span class="reserved">function</span>()
{
  <span class="reserved">return</span> <span class="reserved">this</span>.name;
};

<span class="comment">/**
 * Set the name of this port.
 *
 * <span class="attrib">@see</span> draw2d.Node#getPort
 * <span class="attrib">@param</span> {String} name The new name of this port.
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.setName=<span class="reserved">function</span>(<span class="comment">/*:String*/</span> name)
{
  <span class="reserved">this</span>.name=name;
};

draw2d.Port.<span class="reserved">prototype</span>.isOver = <span class="reserved">function</span> (<span class="comment">/*:int*/</span> iX ,<span class="comment">/*:int*/</span> iY)
{
    var x = <span class="reserved">this</span>.getAbsoluteX()-<span class="reserved">this</span>.coronaWidth-<span class="reserved">this</span>.getWidth()/2;
    var y = <span class="reserved">this</span>.getAbsoluteY()-<span class="reserved">this</span>.coronaWidth-<span class="reserved">this</span>.getHeight()/2;
    var iX2 = x + <span class="reserved">this</span>.width + (<span class="reserved">this</span>.coronaWidth*2)+<span class="reserved">this</span>.getWidth()/2;
    var iY2 = y + <span class="reserved">this</span>.height + (<span class="reserved">this</span>.coronaWidth*2)+<span class="reserved">this</span>.getHeight()/2;
    <span class="reserved">return</span> (iX &gt;= x &amp;&amp; iX &lt;= iX2 &amp;&amp; iY &gt;= y &amp;&amp; iY &lt;= iY2);
};

<span class="comment">/**
 *
 * <span class="attrib">@private</span>
 */</span>
draw2d.Port.<span class="reserved">prototype</span>.showCorona = <span class="reserved">function</span> (<span class="comment">/*:boolean*/</span> flag, <span class="comment">/*:float*/</span> diameter)
{
  <span class="reserved">if</span>(flag===true)
  {
   <span class="reserved">this</span>.corona = new Corona();
   <span class="reserved">this</span>.corona.setAlpha(0.3);
   <span class="reserved">this</span>.corona.setBackgroundColor(new  draw2d.Color(0,125,125));
   <span class="reserved">this</span>.corona.setColor(null);
   <span class="reserved">this</span>.corona.setDimension(<span class="reserved">this</span>.getWidth()+(<span class="reserved">this</span>.getCoronaWidth()*2),<span class="reserved">this</span>.getWidth()+(<span class="reserved">this</span>.getCoronaWidth()*2));
   <span class="reserved">this</span>.parentNode.getWorkflow().addFigure(<span class="reserved">this</span>.corona,<span class="reserved">this</span>.getAbsoluteX()-<span class="reserved">this</span>.getCoronaWidth()-<span class="reserved">this</span>.getWidth()/2, <span class="reserved">this</span>.getAbsoluteY()-<span class="reserved">this</span>.getCoronaWidth()-<span class="reserved">this</span>.getHeight()/2);
  }
  <span class="reserved">else</span> <span class="reserved">if</span>(flag===false &amp;&amp; <span class="reserved">this</span>.corona!==null)
  {
   <span class="reserved">this</span>.parentNode.getWorkflow().removeFigure(<span class="reserved">this</span>.corona);
   <span class="reserved">this</span>.corona = null;
  }
};

<span class="comment">/**
 * Returns the Command to perform the specified Request or null.&lt;br&gt;
 * Inherited figures can override this method to return their own implementation
 * of the request.&lt;br&gt;
 *
 * <span class="attrib">@param</span> {draw2d.EditPolicy} request describes the Command being requested
 * <span class="attrib">@return</span> null or a draw2d.Command
 * <span class="attrib">@type</span> draw2d.Command 
 * <span class="attrib">@since</span> 0.9.15
 **/</span>
draw2d.Port.<span class="reserved">prototype</span>.createCommand=<span class="reserved">function</span>(<span class="comment">/*:draw2d.EditPolicy*/</span> request)
{
   <span class="comment">// the port has its own implementation of the CommandMove</span>
   <span class="comment">//</span>
   <span class="reserved">if</span>(request.getPolicy() ===draw2d.EditPolicy.MOVE)
   {
     <span class="reserved">if</span>(!<span class="reserved">this</span>.canDrag)
        <span class="reserved">return</span> null;
     <span class="reserved">return</span> new draw2d.CommandMovePort(<span class="reserved">this</span>);
   }
   <span class="comment">// Connect request between two ports</span>
   <span class="comment">//</span>
   <span class="reserved">if</span>(request.getPolicy() ===draw2d.EditPolicy.CONNECT)
   {
     <span class="reserved">if</span>(request.source.parentNode.id === request.target.parentNode.id)
        <span class="reserved">return</span> null;
     <span class="reserved">else</span>
        <span class="reserved">return</span> new draw2d.CommandConnect(request.canvas,request.source,request.target);
   }

   <span class="reserved">return</span> null;
};
</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Mon Nov 14 13:45:39 2011</div>
</body>
</html>
